<?php
namespace jy_cmso2o;
defined('BY_JYA') or exit('error');
/*
	本插件：$this->model('model')->方法名();
	其他地方调用：model('jy_cmso2o/model')->方法名();
*/
class model extends \plugin{
	public function get($params,&$total=null,$lat_lng=array()){
		if(!$params['orderby']){
			$params['orderby']=array('id desc');
		}
		$list=$this->pdo_getlist('list',$params,$total);
		foreach($list as &$v){
			$v['logo']=tomedia($v['logo']);
			$v['lat_lng']=json_decode($v['lat_lng'],true);
			$v['juli']=cfc('tools')->getdistance($lat_lng['lng'],$lat_lng['lat'],$v['lat_lng']['lng'],$v['lat_lng']['lat']);
			$v['juli']=intval($v['juli']/1000);
		}
		paixu($list,'juli','asc');
		return $list;
	}
	
}